import { NgModule, ErrorHandler, Injector } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientModule } from '@angular/common/http';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';

import { MyApp } from './app.component';
// native
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
// modules
import { TabPageModule } from '../pages/tab/tab.module';
import { ChatPageModule } from '../pages/chat/chat.module';
import { ChatProvider } from '../providers/chat/chat';
import { BankPageModule } from '../pages/bank/bank.module';
// flux
import { AdepModule } from '../adep/adep.module';
import { InjectionUtils } from '../adep/utils';

@NgModule({
  declarations: [
    MyApp
  ],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    HttpClientModule,
    IonicModule.forRoot(MyApp, {
      backButtonText: '',
      tabsHideOnSubPages: true
    }),
    AdepModule,
    TabPageModule,
    ChatPageModule,
    BankPageModule
  ],
  bootstrap: [
    IonicApp
  ],
  providers: [
    StatusBar,
    SplashScreen,
    { provide: ErrorHandler, useClass: IonicErrorHandler },
    ChatProvider
  ]
})
export class AppModule {
  // flux 依赖
  constructor(private injector: Injector) {
    InjectionUtils.injector = injector;
  }
}
